

*******************************************************************************************
*******************************************************************************************
******************** Reclassification Risk in the Small Group Health Insurance Market
******************* by Sebastian Fleitas, Gautam Gowrisankaran and Anthony Lo Sasso 
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************
******************** Table 4 Enrollee Level
*******************************************************************************************
*******************************************************************************************
*******************************************************************************************

use database_individual_level.dta, replace 
 do Restat_Final_Table3_USIC.do

**************************************************************************************************
** PANEL A: Fixed effects estimates 
**************************************************************************************************
*reghdfe mean_premium yeardum* (mean_pred_riskscore_rp = mean_ORS_riskscore_rp), absorb(mbr_sys_id) vce(cluster customer_number year)

mkspline splinerisk1 1 splinerisk2 = mean_pred_riskscore_rp /*making the spline on the delta for 2015, cross section estimate */

 
** Column 2 top panel 
reghdfe mean_premium mean_pred_riskscore_rp  yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
*reghdfe mean_premium splinerisk1 splinerisk2  yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
gen sample = e(sample)
** Column 3 top panel 
*xtreg   mean_premium mean_pred_riskscore_rp prob_leaving  yeardum* if sample==1, fe cl(customer_number)
*predict eps1 if sample==1, e
reghdfe mean_premium mean_pred_riskscore_rp prob_leaving yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
*reghdfe mean_premium splinerisk1 splinerisk2 prob_leaving yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)

** Column 4 top panel 
reghdfe mean_premium mean_pred_riskscore_rp prob_leaving* yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
*reghdfe mean_premium splinerisk1 splinerisk2 prob_leaving* yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)

***Include the variance of R in the specification 
*reghdfe mean_premium mean_pred_riskscore_rp sd_acg_riskscore prob_leaving* yeardum* , absorb(mbr_sys_id) vce(cluster customer_number year)
********

**************************************************************************************************
** PANEL B: No Fixed effects estimates 
**************************************************************************************************
*predict linear_coef, xbu
*gen res1 = mean_premium - linear_coef
*regress  mean_premium mean_pred_riskscore_rp  marketdum* yeardum* , cl(customer_number)
** Column 2 down panel 

mkspline splineriskA 1 splineriskB = mean_pred_riskscore_rp 

reghdfe  mean_premium mean_pred_riskscore_rp  marketdum* yeardum* if sample==1 ,  noabsorb vce(cluster customer_number year)
*reghdfe  mean_premium splineriskA  splineriskB marketdum* yeardum* if sample==1 ,  noabsorb vce(cluster customer_number year)

*regress  mean_premium mean_pred_riskscore_rp  marketdum* prob_leaving yeardum* , cl(customer_number)
** Column 3 down panel 
reghdfe  mean_premium mean_pred_riskscore_rp  marketdum* prob_leaving yeardum* if sample==1 ,  noabsorb vce(cluster customer_number year)
*reghdfe  mean_premium splineriskA  splineriskB  marketdum* prob_leaving yeardum* if sample==1 ,  noabsorb vce(cluster customer_number year)

*regress  mean_premium mean_pred_riskscore_rp   marketdum* prob_leaving* yeardum* , cl(customer_number)
** Column 4 down panel 
reghdfe  mean_premium mean_pred_riskscore_rp  marketdum* prob_leaving* yeardum* if sample==1 ,  noabsorb vce(cluster customer_number year)
*reghdfe  mean_premium splineriskA  splineriskB  marketdum* prob_leaving* yeardum* if sample==1 ,  noabsorb vce(cluster customer_number year)

